
# Replication of Analysis: The Effect of Selective Exposure on Agenda Diversity: An Experimental Analysis of High-Choice Media Environments and Issue Consensus

# John K. Wagner, jkwagner@unm.edu

# Libraries
library(ggpubr)
library(tidyverse)

# Load Data
df = read.csv(file = "AgendaDiversityExperiment_Shareable.csv")

# Alter Reference Group
df$Group = relevel(factor(df$Group), ref = 2)

# T-tests & Associated Visualization
p <- ggboxplot(df, x = "Group", y = "AgendaTotal",
               color = "Group", palette = "jco",
               add = "jitter")
p + stat_compare_means(method = "t.test", comparisons = list(1:2, 2:3, c(1, 3)))


# Sample Descriptives

## Agenda Total 
summary(df$AgendaTotal)

## Group
table(df$Group)
table(df$Group) %>% prop.table() 

## Gender
table(df$Demo_Gender)
table(df$Demo_Gender) %>% prop.table() 

## Race
table(df$Demo_Race)
table(df$Demo_Race) %>% prop.table() 

## Party
table(df$Demo_Party)
table(df$Demo_Party) %>% prop.table() 

## Income
table(df$Demo_Income)
table(df$Demo_Income) %>% prop.table() 

## Education
table(df$Demo_Education)
table(df$Demo_Education) %>% prop.table() 

## Age
table(df$Demo_Age)
table(df$Demo_Age) %>% prop.table() 
